<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="renderer" content="webkit">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,minimal-ui">
<%@ include file="/WEB-INF/component/commonCSS.jsp"%>
<style type="text/css">
	#shclNs {
           position:fixed;
           left:0px;
           top:0px;
           width:100%;
           height:100%;
           opacity:0.75;
           -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=75)";
           filter:alpha(opacity=75);
           background-color: gray;
           margin:0px;
           padding:0px;
           z-index:999999;
           background:url('${ctx}/lib/img/loading.gif') no-repeat center center;
        }
</style>
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame" style="height:650px;overflow-y:scroll;"  >
<div id="shclNs" ></div>
<div class="box box-primary" id="more" style="width:110px;height:35px;background-color:#222c32;position:absolute;z-index:9999;left:850px;top:100px;display:none;font-size:12px;border-top-color:#222c32;">
            <div class="box-body home-message" id="moreOp" >
            </div>
</div>
	<section class="content-header">
		<h1>资质申报</h1>
		<ol class="breadcrumb">
			<li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i>首页</a></li>
			<li class="active"><a href="#">药品招标管理</a></li>
			<li class="active"><a href="#">投标企业信息管理 </a></li>
			<li class="active"><a href="#">企业资质申报</a></li>
		</ol>
		
</section>
<section class="content" >
<div class=" box box-success"  >
<div id="wrapper">
<div id="content" ></div>
<script id="test" type="text/html">
  {{each rows as row i}}
			<div class="col-xs-6 col-lg-4 hei">
				<div class="wrapper2 ">
					<a id=""  href="javascript:showImg('{{row.profilePicAddr}}','{{row.profileName}}');" ><img class="img-responsive" border="0" src="${ctx}/{{row.profilePicShortcutAddr}}"></a>
<label style="width: 278px;">
				   <div class="row" style=" margin-left: -12;margin-left: -23px;" >
						<div class="col-md-12">
							<p class="pull-left imgButton">
     								 <input type="checkbox" class="checkbox" name="compprofileIds" value="{{row.compprofileId}}" /input>
							</p>
						</div>
					</div> 
</label>
                    <div class="row" style="margin-left:0px">
						<div class="col-md-12">
							<p class="pull-left">
								<div class="productInfo" >&nbsp;资质编号:<span class="productInfo" name="profileCode" >{{row.profileCode}}</span></div>
							</p>
						</div>
					</div>
					<div class="row"  style="margin-left:0px">
						<div class="col-md-12">
							<p class="pull-left">
								<div class="productInfo" >&nbsp;资质名称:<span class="productInfo" name="profileCode" >{{row.profileName}}</span></div>
							</p>
						</div>
					</div>
					<div class="row"  style="margin-left:0px">
						<div class="col-md-12">
							<p class="pull-left">
								<div class="productInfo" >&nbsp;有效期:<span class="productInfo" name="profileTime" >{{row.profileStarttime}}&nbsp;至&nbsp;{{row.profileEndtime}}</span></div>
						    </p>
						</div>
					</div>
					<div class="row"  style="margin-left:0px">
						<div class="col-md-12">
							<p class="pull-left">
								<div class="productInfo" >&nbsp;状态:<span class="productInfo" name="status" >{{row.status | formatStatus}}</span></div>
							</p>
						</div>
					</div>
					<div class="row"  style="margin-left:0px">
						<div class="col-md-12">
							<p class="pull-left">
								<div class="productInfo" >&nbsp;备注:<span class="productInfo" name="remarks" >{{row.remarks}}</span></div>
							</p>
						</div>
					</div>
					
				</div>
			</div>
 {{/each}}
</script>	
</div>
</div>
<div style="height:50px"></div>
</section>
<div class="mainA">
<div class="mainB"></div>
<div class="mainC"></div>
<div class="main" >
 	<!-- <button type="button" class="btn btn-default btn-sm"  onclick="commit();">提&nbsp;交</button> -->
	<a href="javascript:history.go(-1)" class="btn btn-danger btn-sm">返&nbsp;回</a> 		 
</div>
</div>

</body>
<%@ include file="/WEB-INF/component/commonJS.jsp"%>
<script type="text/javascript">
/*格式化启用/停用 下拉编辑*/
 template.helper('formatStatusEdit', function(data) {
	return data == 1 ? "停&nbsp;用" : "启&nbsp;用";
});	
/*格式化启用停用 */
template.helper('formatStatus', function(data) {
	return data == 1 ? "启用" : "停用";
}); 

var records = 0;//总条目
var postData = {"rows":3,"page":1};//rows 一页展示多少条   page当前页数
	$(function() {
		getList(postData);
	    $(window).scroll(function() {
            if ($(document).scrollTop()+30 >= $(document).height() - $(window).height()) {
            	postData.page++;
            	if (postData.page <=Math.ceil(records/postData.rows)) {
            		getList(postData);
            	} 
            }
         });
});
	function getList(postData){
		$("#shclNs").show();
			$.post('${ctx}/bidProjcompprofile/getCompprofileList.html?projId=${projId}',
					postData, function(result) {
						if (result.success) {
							$("#shclNs").hide();
							if(result.rows.length==0){
								$("#wrapper").append("<h1>暂无可以申报的资质</h1><br/>");
								return;
							} 
							if(result.form==1){
                                var html = template('test', result);
                                $('#content').append(html);
                                records=result.records;  //总条数
                                $(".main").html("<label onclick='commit();' class='btn btn-success btn-sm'>提&nbsp;交</label>")
                     	}else if(result.form==2){
                     		   $('#content').html("");    
                     		   $.HN.message.alert("项目申报时间已过期！！", "消息", "info");
                     		 
                     	}else{
                     		   var html = template('test', result);
                                $('#content').append(html);
                                $(".main").html("<label onclick='commit();' class='btn btn-success btn-sm'>提&nbsp;交</label> <a href='javascript:history.go(-1)' class='btn btn-danger btn-sm'>返&nbsp;回</a>")
                                records=result.records;  //总条数
                     	}
                     	$('#addNew').bind("click",function(){
                     		addNew();
                     	});
						} else {
							$.HN.message.alert("数据获取失败", '信息', 'error');
						}
					}, "json");
		}
	
	 function commit(){
		    var len = $("[name='compprofileIds']:checked").length
             if (len<1){
            	 $.HN.message.alert('请至少勾选一条企业资质', '提示信息', 'success');
            	 return;
             }
	    	$.HN.message.confirm("已选择"+len+"个,确定要提交吗？", '', '').on(function (e) {
	            if (e) {
	            	var text = "";
	    		    $("[name='compprofileIds']:checked").each(function(){
	    		    	text+=$(this).val()+',';
	    		    })
	    		    text = text.substring(0,text.length-1);
	              $.post("${ctx}/bidProjcompprofile/commitCompprofile.html",{"array":text,"projId":"${projId}"},function(result){
	            		if(result.success){
	      	     			$.HN.message.alert('操作成功！', '提示信息', 'success');
	      	     			setTimeout("document.location.reload()",500);
	              		}else{
	              			$.HN.message.alert(result.msg || "提交失败！", "消息", "error");
	              		}
	              },"json")
	          	  
	          } 
	  	  });
	    }
	

    function selectImg() {
    	$('#profilePicAddr').click();
    }

	function showImg(imgPath,profileName) {
		var url = "/medstgmini/acctInfo/toImg.html";
		$.HN.dialog.open({
			"id" : "showImg",
			"title" : profileName,
			"url" : url,
			"data" : {
				"imgPath" : imgPath
			},
			"width" : 800,
			"height" : 400,
			"closefunc" : function(params) {
				if (params) {

				}
			}
		});
	}
</script>
</html>